package com.example.graph.repository;

import com.example.graph.entity.Know;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
/**
 * @ClassName: KnowRepository
 * @Description:
 * @Author: keke
 * @Date: 2021/6/7 11:24
 */
@Repository
public interface KnowRepository extends Neo4jRepository<Know,Long> {

    @Query("MATCH (fromNode) WHERE id(fromNode) = {fromId} MATCH (toNode) WHERE id(toNode) = {toId} MATCH (fromNode)-[r]->(toNode) DELETE r")
    void deleteByNodeId(@Param(value = "fromId") long fromId, @Param(value = "toId") long toId);

}
